<html>
<head><meta charset="utf-8"><title>trivial inliner · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html">trivial inliner</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="206830766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206830766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206830766">(Aug 13 2020 at 15:35)</a>:</h4>
<p>Would it make sense to add an optimization which only inlines functions which do not call any other function and try to run that opt with <code>mir-opt-level=1</code>?</p>



<a name="206830984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206830984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206830984">(Aug 13 2020 at 15:37)</a>:</h4>
<p>I think that makes sense</p>



<a name="206831052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831052">(Aug 13 2020 at 15:37)</a>:</h4>
<p>I guess we'd have to benchmark -- I personally suspect that's going to catch so few cases as to not be worth the analysis and other costs involved</p>



<a name="206831225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831225">(Aug 13 2020 at 15:38)</a>:</h4>
<p>Yeah, I guess simulacrum is right. It depends on how much this pattern appears in practice</p>



<a name="206831284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831284">(Aug 13 2020 at 15:38)</a>:</h4>
<p>I guess it would catch trivial cases like <code>Option::is_some()</code> perhaps, which could be good</p>



<a name="206831346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831346">(Aug 13 2020 at 15:39)</a>:</h4>
<p>I am thinking of stuff like <code>Option::as_ref</code> and friends which are used fairly frequently and afaik currently inhibit other optimizations</p>



<a name="206831355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831355">(Aug 13 2020 at 15:39)</a>:</h4>
<p>Right</p>



<a name="206831371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831371">(Aug 13 2020 at 15:39)</a>:</h4>
<p>Hmm</p>



<a name="206831477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831477">(Aug 13 2020 at 15:40)</a>:</h4>
<p>we can just try it out</p>



<a name="206831481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831481">(Aug 13 2020 at 15:40)</a>:</h4>
<p>An alternative could be to just have a list of all the std functions that have this property and inline them as soon as you see them</p>



<a name="206831551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831551">(Aug 13 2020 at 15:40)</a>:</h4>
<p>Do you mean an attribute <code>#[rustc_trivial_inline]</code> or something?</p>



<a name="206831565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831565">(Aug 13 2020 at 15:40)</a>:</h4>
<p>Yas!</p>



<a name="206831675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831675">(Aug 13 2020 at 15:41)</a>:</h4>
<p>That would get you some of the way there, and I think it would definitely show up in the benchmarks if this has potential :3<br>
<span class="user-mention" data-user-id="116122">@simulacrum</span> how does that sound?</p>



<a name="206831801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831801">(Aug 13 2020 at 15:42)</a>:</h4>
<p>I would not want such an attribute generally speaking, we should start with the simpler option</p>



<a name="206831844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831844">(Aug 13 2020 at 15:42)</a>:</h4>
<p>will try to bodge something together today</p>



<a name="206831872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206831872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206831872">(Aug 13 2020 at 15:42)</a>:</h4>
<p>I think getting something good enough for first benchmarks should be fairly easy</p>



<a name="206832240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206832240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206832240">(Aug 13 2020 at 15:45)</a>:</h4>
<p>Ah yes, the attribute is a separate discussion for sure</p>



<a name="206832283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206832283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206832283">(Aug 13 2020 at 15:45)</a>:</h4>
<p>But what I meant is having a list of the "trivial to inline" fns in std</p>



<a name="206845671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206845671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206845671">(Aug 13 2020 at 17:37)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> If you mess with the <code>should_inline</code> function on the existing inliner, you should be able to get it do only inline functions that don't call other functions pretty easily.</p>



<a name="206845929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206845929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206845929">(Aug 13 2020 at 17:39)</a>:</h4>
<p>I think I had tested something pretty close to that in this commit <a href="https://github.com/rust-lang/rust/commit/302a4ecea0248b5cd672e3d608174a8d09f61705">https://github.com/rust-lang/rust/commit/302a4ecea0248b5cd672e3d608174a8d09f61705</a></p>
<p>With ... interesting perf results <a href="https://perf.rust-lang.org/compare.html?start=dd155df0a69338757ca39a2a606a6accb7b8d342&amp;end=6989784c64acc4dbf0ddb012c416f1003790b219">https://perf.rust-lang.org/compare.html?start=dd155df0a69338757ca39a2a606a6accb7b8d342&amp;end=6989784c64acc4dbf0ddb012c416f1003790b219</a></p>



<a name="206847137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206847137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206847137">(Aug 13 2020 at 17:49)</a>:</h4>
<p>do we not inline constructors</p>



<a name="206847176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206847176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206847176">(Aug 13 2020 at 17:49)</a>:</h4>
<p>with the default opt level?</p>



<a name="206847255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206847255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206847255">(Aug 13 2020 at 17:50)</a>:</h4>
<p><a href="https://rust.godbolt.org/z/o6G9q5">https://rust.godbolt.org/z/o6G9q5</a></p>



<a name="206847472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206847472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206847472">(Aug 13 2020 at 17:51)</a>:</h4>
<p>The MIR inliner is flagged off under <code>-Zmir-opt-level=2</code> so it doesn't run unless you explicitly change the mir opt leve.</p>



<a name="206847585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206847585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206847585">(Aug 13 2020 at 17:52)</a>:</h4>
<p>does the <code>HINT_THRESHHOLD</code> apply to constructors</p>



<a name="206847741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206847741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206847741">(Aug 13 2020 at 17:53)</a>:</h4>
<p>There's no special treatment for constructors as far as I'm aware but it's been a while since I was in this code.</p>



<a name="206847841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206847841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206847841">(Aug 13 2020 at 17:54)</a>:</h4>
<p>Constructors are lowered to <code>Rvalue::Aggregate</code> when constructing MIR.</p>



<a name="206848082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206848082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206848082">(Aug 13 2020 at 17:56)</a>:</h4>
<p><a href="https://rust.godbolt.org/z/o6G9q5">https://rust.godbolt.org/z/o6G9q5</a></p>
<p>right, what would be needed to fix that example then?</p>



<a name="206848194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206848194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206848194">(Aug 13 2020 at 17:57)</a>:</h4>
<p>What do you mean by fix?</p>



<a name="206848256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206848256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206848256">(Aug 13 2020 at 17:58)</a>:</h4>
<p>optimizing it to <code>_0 = move _1</code></p>



<a name="206848314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206848314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206848314">(Aug 13 2020 at 17:58)</a>:</h4>
<p>That would probably be copy propagation</p>



<a name="206848518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206848518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206848518">(Aug 13 2020 at 18:00)</a>:</h4>
<p>We do have a copy propagation pass which is (I think) under <code>mir-opt=3</code> but it doesn't seem to completely eliminate it either.</p>



<a name="206848540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206848540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206848540">(Aug 13 2020 at 18:00)</a>:</h4>
<p>I wonder if the projection is throwing it off</p>



<a name="206848559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206848559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206848559">(Aug 13 2020 at 18:00)</a>:</h4>
<p>IIRC it's pretty basic</p>



<a name="206848568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206848568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206848568">(Aug 13 2020 at 18:00)</a>:</h4>
<p>and uh very slow lol</p>



<a name="206851209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206851209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206851209">(Aug 13 2020 at 18:23)</a>:</h4>
<p>dest prop should handle that case</p>



<a name="206853490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206853490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206853490">(Aug 13 2020 at 18:43)</a>:</h4>
<p>running this I get a bunch of "this arithmetic operation will overflow" errors</p>



<a name="206853582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206853582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206853582">(Aug 13 2020 at 18:44)</a>:</h4>
<p>are they gated on opt level (if they consider inlining)</p>



<a name="206853687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206853687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206853687">(Aug 13 2020 at 18:45)</a>:</h4>
<p>I think const prop emits those, and it runs after inlining</p>



<a name="206853695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206853695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206853695">(Aug 13 2020 at 18:45)</a>:</h4>
<p>I am not even sure where these errors are caused</p>
<div class="codehilite"><pre><span></span><code>error: this arithmetic operation will overflow
   --&gt; library/core/src/ops/arith.rs:94:45
    |
86  | / macro_rules! add_impl {
87  | |     ($($t:ty)*) =&gt; ($(
88  | |         #[stable(feature = &quot;rust1&quot;, since = &quot;1.0.0&quot;)]
89  | |         impl Add for $t {
...   |
94  | |             fn add(self, other: $t) -&gt; $t { self + other }
    | |                                             ^^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8` which would overflow
...   |
98  | |     )*)
99  | | }
    | |_- in this expansion of `add_impl!`
100 |
101 |   add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
    |   ------------------------------------------------------------------------- in this macro invocation
    |
    = note: `#[deny(arithmetic_overflow)]` on by default
</code></pre></div>



<a name="206853706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206853706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206853706">(Aug 13 2020 at 18:45)</a>:</h4>
<p>It shouldn't cause any false positives though</p>



<a name="206853915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206853915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206853915">(Aug 13 2020 at 18:47)</a>:</h4>
<p>can I somehow get the method into which this was inlined?</p>



<a name="206858571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206858571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206858571">(Aug 13 2020 at 19:25)</a>:</h4>
<p>oh god</p>



<a name="206858575"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206858575" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206858575">(Aug 13 2020 at 19:25)</a>:</h4>
<p>why</p>



<a name="206858634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206858634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206858634">(Aug 13 2020 at 19:25)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/0a49057dd35d9bd2fcc9760a054809c30eee2a58/library/core/src/iter/range.rs#L207">https://github.com/rust-lang/rust/blob/0a49057dd35d9bd2fcc9760a054809c30eee2a58/library/core/src/iter/range.rs#L207</a></p>



<a name="206858850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206858850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206858850">(Aug 13 2020 at 19:27)</a>:</h4>
<p>why arent we just using <code>Add::add</code> directly here?</p>



<a name="206859053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206859053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206859053">(Aug 13 2020 at 19:28)</a>:</h4>
<p>heh, presumably <code>Self::MAX + 1</code> gives the warning even today?</p>



<a name="206859119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206859119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206859119">(Aug 13 2020 at 19:29)</a>:</h4>
<p>yeah</p>



<a name="206859148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206859148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206859148">(Aug 13 2020 at 19:29)</a>:</h4>
<p>but why are we using <code>Add::add(Self::MAX, 1)</code> instead of <code>start + n</code></p>



<a name="206859172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206859172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206859172">(Aug 13 2020 at 19:29)</a>:</h4>
<p>which should do the same thing without needing that hack</p>



<a name="206861026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206861026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206861026">(Aug 13 2020 at 19:45)</a>:</h4>
<p>Perhaps LLVM isn't smart enough to optimize out <code>start + n</code> in release mode for some reason? Seems unlikely to me though</p>



<a name="206861230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206861230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206861230">(Aug 13 2020 at 19:46)</a>:</h4>
<p>My thought is that <code>start + n</code> replaces both the if branch in debug builds and <code>start.wrapping_add</code>in opt builds afaict</p>



<a name="206861416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206861416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206861416">(Aug 13 2020 at 19:48)</a>:</h4>
<p>aaah, if <code>n as Self</code> is truncating this breaks</p>



<a name="206862097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206862097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206862097">(Aug 13 2020 at 19:53)</a>:</h4>
<p>opened <a href="https://github.com/rust-lang/rust/issues/75495">#75495</a>, some tests are still failing rn</p>



<a name="206862239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206862239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206862239">(Aug 13 2020 at 19:54)</a>:</h4>
<p>some just need <code>// compiler-flags: mir-opt-level=0</code> because less functions hit codegen now or something</p>



<a name="206862258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206862258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206862258">(Aug 13 2020 at 19:54)</a>:</h4>
<p>there's one ICE</p>



<a name="206862294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206862294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206862294">(Aug 13 2020 at 19:55)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error: internal compiler error: src/librustc_trait_selection/traits/codegen/mod.rs:75:17: Encountered error `OutputTypeParameterMismatch(Binder(&lt;[closure@/home/lcnr/rust2/src/test/ui/async-await/async-await.rs:212:9: 216:10] as std::ops::Fn&lt;(&amp;u8,)&gt;&gt;), Binder(&lt;[closure@/home/lcnr/rust2/src/test/ui/async-await/async-await.rs:212:9: 216:10] as std::ops::Fn&lt;(&amp;u8,)&gt;&gt;), Sorts(ExpectedFound { expected: impl std::future::Future, found: std::future::from_generator::GenFuture&lt;[static generator@/home/lcnr/rust2/src/test/ui/async-await/async-await.rs:213:24: 215:14 x:&amp;u8 for&lt;&#39;r, &#39;s&gt; {std::future::ResumeTy, &amp;&#39;r u8, impl std::future::Future, ()}]&gt; }))` selecting `Binder(&lt;[closure@/home/lcnr/rust2/src/test/ui/async-await/async-await.rs:212:9: 216:10] as std::ops::Fn&lt;(&amp;u8,)&gt;&gt;)` during codegen
</code></pre></div>



<a name="206862960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206862960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206862960">(Aug 13 2020 at 20:00)</a>:</h4>
<p>I think that's existing <a href="https://github.com/rust-lang/rust/issues/68347">https://github.com/rust-lang/rust/issues/68347</a></p>



<a name="206867769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206867769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206867769">(Aug 13 2020 at 20:35)</a>:</h4>
<p>I think the problem with <code>start + n</code> is when <code>std</code> is built in release, but you want the user's level for debug assertions</p>



<a name="206867790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206867790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206867790">(Aug 13 2020 at 20:35)</a>:</h4>
<p>(because <code>std</code> is almost always a release build itself)</p>



<a name="206878024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206878024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206878024">(Aug 13 2020 at 22:13)</a>:</h4>
<p>My recollection is that <code>Add::add</code> calls are used to avoid needing to <code>#[rustc_inherit_overflow_checks]</code> the method.</p>



<a name="206878179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206878179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206878179">(Aug 13 2020 at 22:14)</a>:</h4>
<p>(I've gotten PR feedback to use <code>Add::add</code> when I'd otherwise been using the attribute: <a href="https://github.com/rust-lang/rust/pull/45754#issuecomment-341884683">https://github.com/rust-lang/rust/pull/45754#issuecomment-341884683</a> .  Something might have changed since 2017 on that front, though...)</p>



<a name="206904127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206904127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206904127">(Aug 14 2020 at 07:08)</a>:</h4>
<p>I think we should just figure out how to make <a href="https://github.com/rust-lang/rust/pull/68828">https://github.com/rust-lang/rust/pull/68828</a> faster and solve inlining completely</p>



<a name="206911254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206911254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206911254">(Aug 14 2020 at 09:18)</a>:</h4>
<p>that query currently has a perf regression of less than 3% in all relevant queries, how much comp time do we gain by inlining?</p>



<a name="206911381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206911381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206911381">(Aug 14 2020 at 09:20)</a>:</h4>
<p>that's cheating! (I like it)</p>



<a name="206911390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206911390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206911390">(Aug 14 2020 at 09:20)</a>:</h4>
<p>I'm gonna rebase and try it out</p>



<a name="206911435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206911435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206911435">(Aug 14 2020 at 09:21)</a>:</h4>
<p>also do we want to inline during incremental compilation?</p>



<a name="206911530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206911530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206911530">(Aug 14 2020 at 09:22)</a>:</h4>
<p>The reason I am interested in something like <a href="https://github.com/rust-lang/rust/issues/75495">#75495</a> is because I would <del>expect</del><em>hope</em> this to even give perf benefits with incremental as these small helper methods are often rarely changed and often used</p>



<a name="206960578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206960578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206960578">(Aug 14 2020 at 18:20)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> it would make a lot of sense to me if there was a place for inlining during incremental</p>



<a name="206960608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206960608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206960608">(Aug 14 2020 at 18:20)</a>:</h4>
<p>at least for inlining of these helper methods</p>



<a name="206960617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206960617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206960617">(Aug 14 2020 at 18:21)</a>:</h4>
<p>that are leaf functions</p>



<a name="206960758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206960758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206960758">(Aug 14 2020 at 18:22)</a>:</h4>
<p>Although for some reason whenever I think of "inlining" I also jump to "CGU partitioning". If we see regressions in incremental, maybe that's the place to look for a source?</p>



<a name="206960796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206960796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206960796">(Aug 14 2020 at 18:22)</a>:</h4>
<p>I might be completely off tho, but that's what my gut tells me</p>



<a name="206964113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/trivial%20inliner/near/206964113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/trivial.20inliner.html#206964113">(Aug 14 2020 at 18:53)</a>:</h4>
<blockquote>
<p>@lcnr it would make a lot of sense to me if there was a place for inlining during incremental</p>
</blockquote>
<p>I think so too, which I why fixing the inlining cycles by looking at the mir bodies of all called functions does not seem like the final solution to me (and partially why I thought of trying to only inline leafs)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>